/**
 * Created by Panda on 09/12/2016
 */
(function () {
    'use strict';

    angular
        .module('com.akxx.aqzyk')
        .filter('voiceSrcFilter', voiceSrcFilter)
        .filter('listIsEmpty', listIsEmpty)
        .filter('listIsNotEmpty', listIsNotEmpty)
        .filter('fromJsonFilter', fromJsonFilter);

    /** @ngInject */
    function voiceSrcFilter(APP) {
        return function (voiceSrc) {
            return !!voiceSrc ? APP.url.voiceBase + voiceSrc : "";
        }
    }

    function listIsEmpty() {
        return function (list) {
            return !list || list.length <= 0;
        }
    }

    function listIsNotEmpty() {
        return function (list) {
            return !!list && list.length > 0;
        }
    }

    function fromJsonFilter() {
        return function (data) {
            return !!data ? angular.fromJson(data) : {};
        }
    }
})();
